import type { App } from 'vue'
import { use } from 'echarts/core';
import { CanvasRenderer } from 'echarts/renderers';
import { BarChart, LineChart, PieChart, RadarChart, ScatterChart } from 'echarts/charts';
import {
  GridComponent,
  TitleComponent,
  ToolboxComponent,
  VisualMapComponent,
  TooltipComponent,
  LegendComponent,
  DataZoomComponent,
  GraphicComponent
} from 'echarts/components';
import Chart from './chart/index.vue';

// Manually introduce ECharts modules to reduce packing size

use([
  TitleComponent,
  ToolboxComponent,
  CanvasRenderer,
  VisualMapComponent,
  GridComponent,
  TooltipComponent,
  LegendComponent,
  DataZoomComponent,
  GraphicComponent,
  BarChart,
  LineChart,
  PieChart,
  RadarChart,
  ScatterChart,
]);

export default {
  install(app: App<Element>) {
    app.component('Chart', Chart);
  },
};
